AOS Release Notes v2.0.1
Install
npm install -g https://get_ao.arweave.net
Features
- Bootloader
- Handlers.once (defaults to prepend mode)
- WeaveDrive with Attestors
- WeaveDrive L2 Headers
- Spawn module by name
- Graphql Modules
- msg.reply patch
Bootloader
Bootloader enables users to include a script to evaluate when spawning a process. You can include this script either with the Data
property or with a txId
specified on the On-Boot
Tag.
Examples
via AOS Console using data
echo "print('Hello Bootloader')" > example.lua
aos ex1 --tag-name On-Boot --tag-value Data --data example.lua
As AOS boots up, you should see Hello Bootloader!
AOS Client Version: 2.0.1. 2024
Type "Ctrl-C" twice to exit
Your AOS process: uJvxYDk6Q1JvocgfajNbEcKmqoCDWEksjG6EH1o9xRo
Hello Bootloader
via Spawn message using data
Spawn(ao.env.Module.Id, {
["On-Boot"] = "Data",
Data = [[ print("Hello World!") ]]
})
via AOS Console using txId
aos ex2 --tag-name On-Boot --tag-value 1VAPs_V6iVx-zxuMW7Ns0IrYqqk6LAEDAe1b-EqKP28
via Spawn message using txId
Spawn(ao.env.Module.Id, {
["On-Boot"] = "1VAPs_V6iVx-zxuMW7Ns0IrYqqk6LAEDAe1b-EqKP28"
})
Hanlders.once (defaults to prepend mode)
Now, when Handlers.once is called, it will default to prepend to the top of the Handlers stack.
Handlers.once("Name", function (msg)
-- do something
end)
-- is the same as
Handlers.prepend("Name", "Name", function (msg)
-- do something
end, 1)
WeaveDrive with Attestors
Using WeaveDrive to access dataitems from Arweave with Attestations. When you spawn a process you can provide one or more Attestor
tags with arweave wallet addresses as value. Then the arweave wallets set as attestors can create Attestation
dataItems that authorize access to a specific arweave dataitem using weavedrive.
Here is a short guide on how to use WeaveDrive with Attestors - https://hackmd.io/@ao-docs/r1bixxO-Je
WeaveDrive L2 Headers
Now, weaveDrive users can get L2 dataItem headers using drive.getDataItem(id)
from the WeaveDrive apm module. This features allows indexers to index L2 dataItems and processes like stamps2 to determine if a user is stamping an Atomic Asset. The result is more interoperability with Arweave.
.load-blueprint apm
apm.install('@rakis/WeaveDrive')
local drive = require('@rakis/WeaveDrive')
local metaData = drive.getDataItem('K1jD3xrCJV3UnRtnBuQdd7k8HCwh9TX9GS-kh_Oevvw')
Spawn module by name
Spawn module by name or identifier:
aos gql --module aos-graphql-sqlite-sm
Create a graphql/sqlite process by using the module name.
Graphql Modules
You can now build graphql processes using the graphql custom module:
https://github.com/TillaTheHun0/aos-graphq
msg reply legacy patch
This release provides a blueprint optional patch to allow for old processes to leverage the msg.reply
function.
.load-blueprint patch-legacy-reply
A blueprint that creates a passthrough handler to attach .reply
function to the msg
table, for handlers downstream to leverage.
This allows developers to take advantage of the .receive
function in AOS 2.0 and interact with older AOS 0.x processes. With this patch AOS 0.x processes need to be able to reply with an X-Reference
tag. So that the .receive
co-routine can properly catch the response sent by the calling AOS 2.0 process.
Then open an older process:
aos [my aos process]
And run .load-blueprint patch-legacy-reply
.load-blueprint patch-legacy-reply
Source
You can review the blueprint source here:
https://github.com/permaweb/aos/blob/main/blueprints/patch-legacy-reply.lua
local function patchReply(msg)
if not msg.reply then
msg.reply = function (replyMsg)
replyMsg.Target = msg["Reply-To"] or (replyMsg.Target or msg.From)
replyMsg["X-Reference"] = msg["X-Reference"] or msg.Reference or ""
replyMsg["X-Origin"] = msg["X-Origin"] or ""
return ao.send(replyMsg)
end
end
end
Handlers.prepend("_patch_reply", function (msg) return "continue" end, patchReply)
Fixes:
- bubble up errors during co-routine resume functions - https://github.com/permaweb/aos/pull/374
- update token.lua to check for .reply before using the replay method
- staking blueprint improvement to default unstake delay block wait, and prepend finalize handler.
- fixed bug with Handlers.remove - https://github.com/permaweb/aos/pull/366